<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<!-- 先引入react,再引入react-dom,因为react是核心库，react-dom是扩展库 -->
<!-- 引入以后全局多了一个REACT和ReactDOM对象 -->
<script src="https://cdn.staticfile.org/react/16.4.0/umd/react.development.js"></script>
<script src="https://cdn.staticfile.org/react-dom/16.4.0/umd/react-dom.development.js"></script>
<!-- 用于将jsx转为js -->
<script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
<!-- 准备好一个容器 -->
<div id="example"></div>
<div id="example1"></div>
<div id="example2"></div>
<!-- 此处一定要写babel，不写就是默认js -->
<script type="text/babel">

class Person extends React.Component {
  render(){
    const {name,age,sex} = this.props
    return (
      <ul>
        <li>姓名: {name}</li>
        <li>性别: {sex}</li>
        <li>年龄: {age}</li>
      </ul>
    )
  }
}

const p = {name: "张三",age:18,sex:"女"}
// ReactDOM.render(
// 	<Person  name={p.name} age={p.age} sex={p.sex}/>,
// 	document.getElementById('example')
// );
ReactDOM.render(
	<Person {...p}/>,
	document.getElementById('example')
);

ReactDOM.render(
	<Person age={19}/>,
	document.getElementById('example1')
);
ReactDOM.render(
	<Person age="19"/>,
	document.getElementById('example2')
);

function demo() {
  console.log("nihao");
}
</script>

</body>
</html>